import api from '@/api/index.js'
import {refreshTokenPost} from '@/api/refreshToken.js'

const url = '/setting/dict/'
// 字典===================================================================
// 查询字典列表
export function DictListGet(params) {
  refreshTokenPost(api)
  return api({
    url: url + 'dictlist/',
    method: 'get',
    params: params,
  })
}

// 新增字典
export function DictListPost(data) {
  return api({
    url: url + 'dictlist/',
    method: 'post',
    data: data,
  })
}


// 查询字典单个
export function DictPkGet(pk) {
  return api({
    url: url + 'dictpk/' + pk + '/',
    method: 'get',
  })
}
// 修改字典
export function DictPkPut(data,pk) {
  return api({
    url: url + 'dictpk/' + pk + '/',
    method: 'put',
    data: data,
  })
}

// 删除字典
export function DictPkDelete(pk) {
  return api({
    url: url + 'dictpk/' + pk + '/',
    method: 'delete',
  })
}


// 字典数据===================================================================
// 查询字典数据列表
export function DictDataListGet(params) {
  refreshTokenPost(api)
  return api({
    url: url + 'dictdatalist/',
    method: 'get',
    params: params,
  })
}

// 新增字典数据
export function DictDataListPost(data) {
  return api({
    url: url + 'dictdatalist/',
    method: 'post',
    data: data,
  })
}


// 查询字典数据单个
export function DictDataPkGet(pk) {
  return api({
    url: url + 'dictdatapk/' + pk + '/',
    method: 'get',
  })
}
// 修改字典数据
export function DictDataPkPut(data,pk) {
  return api({
    url: url + 'dictdatapk/' + pk + '/',
    method: 'put',
    data: data,
  })
}

// 删除字典数据
export function DictDataPkDelete(pk) {
  return api({
    url: url + 'dictdatapk/' + pk + '/',
    method: 'delete',
  })
}
